<?php
/**
 * 监听动态
 * @return
 * @author yuncran@126.com
 */

namespace app\api\listener;


use app\model\TrendsCommentModel;
use app\model\TrendsMagModel;
use app\model\TrendsReportModel;
use app\model\TrendsUserLikeModel;

class Trends
{

    /**
     * 清理动态信息后处理业务
     * @param $data
     * @return bool
     * @author yuncran@126.com
     */
    public function handle($data)
    {
        try {
            # 清理评论表 || 点赞表 || 收藏表 || 分享表  || @提到的人  || 举报动态
            TrendsCommentModel::where('trends_id',$data['trends_id'])->delete();  //清理评论表

            TrendsMagModel::where('trends_ids',$data['trends_id'])->delete();  // @提到的人

            TrendsReportModel::where('trends_id',$data['trends_id'])->delete();  // @举报动态

            TrendsUserLikeModel::where('trends_id',$data['trends_id'])->delete();  // @点赞表 || 收藏表

        } catch (\Exception $e) {
            return echoShutDown($e->getMessage() . $e->getLine());
        }
        return true;
    }

}